{% extends "base.html" %}{% load i18n %}
{% block title %}Domain list{% endblock %}
{% block list %}
                                {% if message %}
                                <div class="box">
                                    <h3>Example Unordered List</h3>
                                    <div class="boxContent">
                                        {% if status %}
                                        <p class="success">Operation Success! {{ message }}</p>
                                        {% else %}
                                        <p class="error">Operation Failed! {{ message }}</p>
                                        {% endif %}
                                    </div>
                                </div>
                                {% endif %}
                                {% for domain in object_list %}
                                <div class="box">
                                    <h3>{% trans "Zone editor" %}</h3>
                                    <div class="boxContent">
                                        <table>
                                            {% with domain.edit_form as form %}
                                            <form action="update/" method=POST>
                                                {% for field in form %}
                                                <tr class="{% cycle "rowA" "rowB" %}">
                                                    <label>
                                                         <td>{{ field }}</td>
                                                         <td>{{ field.label|safe }}</td>
                                                    </label>
                                                    <td>{{ field.help_text }}</td>
                                                </tr>
                                                {% endfor %}
                                                <tr class="rowC">
                                                    <td colspan=3><input type="submit" name="update" value="Update SOA"></td>
                                                </tr>
                                            </form>
                                            {% endwith %}
                                        </table>
                                        <p>{% trans "Changes not recommended unless you know what you are doing" %}</p>
                                    </div>
                                </div>
                                <div class="box">
				     <h3>{% trans "Records editor" %}</h3>
				     <div class="boxContent">
				         <table width="100%">
					     <tr>
					         <th>name</th>
						 <th>ttl</th>
						 <th>type</th>
						 <th>aux</th>
						 <th>data</th>
						 <th>edit</th>
					    </tr>
					    {% for zone in domain.records %}{% with zone.edit_form as form %}
                                            <form action="zone/{{ zone.id }}/" method=POST>
                                                <tr class="{% if zone.valid %}valid{% else %}notvalid{% endif %} {% cycle "rowA" "rowB" %}">
                                                    {% for field in form %}
                                                    {% if field.is_hidden %}
                                                    {{ field }}
                                                    {% else %}
                                                    <td>{{ field }}</td>
                                                    {% endif %}
                                                    {% endfor %}
                                                    <td>
                                                        <input type="submit" name="update" value="Update">
                                                        <input type="submit" name="update" value="Delete">
                                                    </td>
                                               </tr>
                                            </form>
                                            {% endwith %}{% endfor %}
                                            <form action="zone/add/" method=POST>
                                                <tr class="rowC">
                                                    {% for field in form %}
                                                    {% if field.is_hidden %}
                                                    {{ field }}
                                                    {% else %}
                                                    <td>{{ field }}</td>
                                                    {% endif %}
                                                    {% endfor %}
                                                    <td><input type="submit" name="add" value="Add"></td>
                                                </tr>
                                            </form>
				        </table>
                                    </div>
                                </div>
                                {% endfor %}
                                <div class="box">
                                    <h3>{% trans "Configuration preview" %}</h3>
                                    <div class="boxContent">
				        {% for domain in object_list %}
					<textarea rows="10" cols="76" name="text" readonly>{% include "domains/zone" %}</textarea>{% endfor %}
                                    </div>
                                </div>
{% endblock %}
